define(["jquery", "easy-admin", "echarts", "echarts-theme"], function ($, ea, echarts, undefined) {
    var Controller = {
        index: function () {
            var echartsRecords = echarts.init(document.getElementById('echarts-records'));
            var optionRecords = {
                title: {
                    text: ''
                },
                tooltip: {
                    trigger: 'axis'
                },
                legend: {
                    data: chart_data['name']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                toolbox: {
                    feature: {
                        saveAsImage: {}
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: chart_data['day']
                },
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        name: chart_data['name'][0],
                        type: 'line',
                        stack: '元',
                        data: chart_data['total_amount']
                    },
                ]
            };
            echartsRecords.setOption(optionRecords);
            window.addEventListener("resize", function () {
                echartsRecords.resize();
            });
        }
    };
    return Controller;
});